﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using tf2hudmaker.Properties;

namespace tf2hudmaker.Forms
{
    public partial class form_preview : Form
    {
        public form_preview()
        {
            InitializeComponent();

            form_preview.PREVIEW = this;
            SetSize();
            this.startingsize = this.Size;
        }

        private void picturebox_preview_DoubleClick(object sender, EventArgs e)
        {
            if (!Fixed)
            {
                SetSize();
            }
        }

        public void CenterWindow()
        {
            CenterToScreen();
        }

        private bool Fixed;
        public Size startingsize;

        public void SetPosition(bool newposstyle)
        {
            Fixed = newposstyle;

            if (Fixed)
            {
                this.Dock = DockStyle.Top;
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            }
            else
            {
                this.Dock = DockStyle.None;
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
            }

            SetSize();
        }

        public void SetSize()
        {
            float ratio = 1920f / 1080f;
            this.Size = new Size(this.Size.Width, (int)((float)this.Size.Width / ratio));
        }

        public void SetImage(int number)
        {
            int id = form_preview.idArray[number];

            switch (id)
            {
                case 1: this.picturebox_preview.Image = Resources.tf2_1; break;
                case 2: this.picturebox_preview.Image = Resources.tf2_2; break;
                case 3: this.picturebox_preview.Image = Resources.tf2_3; break;
                case 4: this.picturebox_preview.Image = Resources.tf2_4; break;
                case 5: this.picturebox_preview.Image = Resources.tf2_5; break;
            }
        }

        // STATIC PART
        public static form_preview PREVIEW;
        public static void ChangePreviewList(Int32[] idarray)
        {
            form_preview.idArray = idarray;
        }

        public static Int32[] idArray;

        public static Int32[] previewlist01 = {1,2,3,4,5};
    }
}
